/**
 * 员工数据
 */
import request from '@/utils/request'
/**
 * @description: 获取下拉员工数据
 * @param {*}
 * @return {*}
 */
export function getEmployeeSimple () {
  return request({
    url: '/sys/user/simple'
  })
}
/**
 * 获取员工列表
 * @param {*} params {page:页码,size:每页展示的数据}
 * @returns
 */
export function getEmployeeListApi (params) {
  return request({
    url: '/sys/user',
    params
  })
}
/**
 * 删除员工
 * @param {*} id 员工id
 * @returns
 */
export function delEmployeeApi (id) {
  return request({
    url: `/sys/user/${id}`,
    method: 'delete'
  })
}
/**
 *
 * @param {*} data {uanme:员工名字,mobile:员工手机号,formOfEmployment:员工聘用形式 1正式 2非正式 workNumber:员工工号,departmentName:员工部门名字,timeOfEntry:员工入职日期,correctionTime:员工转正日期 }
 * @returns
 */
export function addEmployeeApi (data) {
  return request({
    url: `/sys/user`,
    method: 'post',
    data
  })
}
/**
 * @description: 导入excel
 * @param {*} data
    [{
      	 mobile: 15751786320
      	 timeOfEntry: "2019-03-09T16:00:00.000Z"
     	 username: "测试人员1"
     	 workNumber: 88088,
     	 formOfEmployment: 0,
     	 departmentName: "技术部"
      }
    ]
 * @return {*}
 */
export function importEmployee(data) {
  return request({
    url: '/sys/user/batch',
    method: 'post',
    data
  })
}
/**
 * @description: 为用户分配角色
 * @param {*} data { id:当前用户id, roleIds:选中的角色id组成的数组 }
 * @return {*}
 */
export function assignRoles(data) {
  return request({
    url: '/sys/user/assignRoles',
    data,
    method: 'put'
  })
}
